package org.obis.portal.ws.action;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.obis.portal.ws.model.TaxonRecord;
import org.springframework.jdbc.core.RowMapper;

/**
 * A simple factory class for a taxon based on a SQL resultset
 * @author tim
 */
public class TaxonRecordRowMapper implements RowMapper {
	@Override
	public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
		TaxonRecord taxon = new TaxonRecord();
		taxon.setId(rs.getLong("id"));
		taxon.setScientificName(rs.getString("scientificName"));
		taxon.setAuthority(rs.getString("authority"));
		return taxon;
	}

}
